package com.chinairi.mall.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chinairi.mall.controller.viewobject.ReceiveAddressVO;
import com.chinairi.mall.model.*;
import com.chinairi.mall.service.modelobject.GoodsShoppingCartMO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 购物车表 Mapper 接口
 * </p>
 *
 * @author gsl
 * @since 2020-09-26
 */
public interface GoodsShoppingCartMapper extends BaseMapper<GoodsShoppingCart> {

    /**
     * 批量插入购物车
     *
     * @param goodsShoppingCartList
     */
    void batchInsert(@Param("goodsShoppingCartList") List<GoodsShoppingCart> goodsShoppingCartList);

    /**
     * 获取用户的购物车
     *
     * @param userId
     * @return
     */
    List<GoodsShoppingCartMO> selectByUserId(@Param("userId") String userId);

    /**
     * 更新购物车中商品数量
     *
     * @param scId
     * @param cartGoodsNumber
     */
    void updateGoodsNumber(@Param("scId") String scId, @Param("cartGoodsNumber") Float cartGoodsNumber);


    /**
     * 采购服务
     *
     * @param userId
     * @return
     */
    List<ProjectPlanPurchaseBuy> selectBuy(@Param("userId") String userId);

    /**
     * 获取运输服务
     *
     * @param userId
     * @return
     */
    List<ProjectPlanPurchaseTransport> selectTransport(@Param("userId") String userId);

    /**
     * 仓储服务
     *
     * @param userId
     * @return
     */
    List<ProjectPlanPurchaseStorage> selectStorage(@Param("userId") String userId);

    /**
     * 购物车质控服务
     *
     * @param userId
     * @return
     */
    List<ProjectPlanPurchaseQuality> selectQuality(@Param("userId") String userId);

    /**
     * 结算服务
     *
     * @param userId
     * @return
     */
    List<ProjectPlanPurchaseSettle> selectSettle(@Param("userId") String userId);

    /**
     * 获取用户购物车商品数量
     *
     * @param userId
     * @return
     */
    Integer selectCountGoodsNum(@Param("userId") String userId);

    /**
     * 获取采购计划中的生产过程控制
     *
     * @param userId
     * @return
     */
    List<ProjectPlanPurchaseControl> selectControl(@Param("userId") String userId);

    /**
     * 根据采购计划和商品ID查询购物车中的商品
     *
     * @param goodsShoppingCartList
     * @return
     */
    List<GoodsShoppingCart> selectBatchByPurchaseAndGoodsId(@Param("goodsShoppingCartList") List<GoodsShoppingCart> goodsShoppingCartList);

    /**
     * 根据采购计划ID获取收货地址
     *
     * @param planPurchaseId
     * @return
     */
    ReceiveAddressVO getReceiveAddress(@Param("planPurchaseId") String planPurchaseId);
}
